#include<iostream>
#include<memory>
#include"UdpServer.hpp"

void Usage()
{
    std::cout<<"Usage:\n"<<"./UdpServer port"<< std::endl;
} 
int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        LOG(FATAL,"socket usage error\n");
        Usage();
        exit(USAGE_ERROR);
    }
    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);
    //打开日志,默认将信息打印到屏幕上
    EnableScreen();
    //智能指针创建UdpServer
    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(port);
    //初始化
    usvr->InitServer();
    //启动udpserver
    usvr->Stat();
    return 0;
}